using GameFramework.Network;
using Unity.VisualScripting;
using NetworkClosedEventArgs = UnityGameFramework.Runtime.NetworkClosedEventArgs;

namespace LS.UGFUnits
{
    [UnitShortTitle("Network")]
    [UnitSurtitle("Closed")]
    public sealed class NetworkClosed : FrameworkEventUnit<NetworkClosedEventArgs>
    {
        protected override int EventId => NetworkClosedEventArgs.EventId;
        protected override string HookName => UGFHookNames.NetworkClosed;

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput NetworkChannel
        {
            get;
            private set;
        }

        protected override void Definition()
        {
            base.Definition();
            NetworkChannel = ValueOutput<INetworkChannel>(nameof(NetworkChannel));
        }

        protected override void AssignArguments(Flow flow, NetworkClosedEventArgs args)
        {
            base.AssignArguments(flow, args);
            flow.SetValue(NetworkChannel, args.NetworkChannel);
        }
    }
}